﻿using Microsoft.EntityFrameworkCore;
using Repository.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Repository.DBContext {
	internal class SurveyDbContext : DbContext {
		public SurveyDbContext() {
			this.Database.EnsureCreated();
		}
		public SurveyDbContext(DbContextOptions<SurveyDbContext> options) : base(options) {
			this.Database.EnsureCreated();
		}
		protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
			=> optionsBuilder.UseMySQL("server=localhost;uid=root;password=daili666;database=surveydb");

		public DbSet<User> Users { get; set; }
		public DbSet<Survey> Surveys { get; set; }
		public DbSet<CompletedSurvey> CompletedSurveys { get; set; }
		public DbSet<Question> Questions { get; set; }
		//public DbSet<ChoiceQ> ChoiceQs { get; set; }
		public DbSet<ChoiceAnswer> ChoiceAnswers { get; set; }
		//public DbSet<ShortAnswerQ> ShortAnswerQs { get; set; }
		public DbSet<Choice> Choices { get; set; }
		public DbSet<ShortAnswer> ShortAnswers { get; set; }
	}
}
